package com.geostar.constructionland.analyse.mapper.sptalyresult;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.geostar.constructionland.analyse.entity.alyresult.AlyResultYphx;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AlyResultYphxMapper extends BaseMapper<AlyResultYphx>{
    @Select({"<script> ",
            " SELECT aa.fxid, aa.zymj_ys, aa.zymj  FROM jsyd_fx_bphx aa WHERE fxbs =#{fxbs} and cdbs is null ORDER BY zymj_ys DESC, trunc( zymj_ys, 1 ) - round( zymj_ys, 0 )",
            " <when test='sortType!=null'>",
            " ${sortType}",
            " </when>",
            " </script>"})
    List<AlyResultYphx> getSortedBphxList(@Param("fxbs") String fxbs,@Param("sortType")String sortType);


    @Update(" update jsyd_fx_bphx set zymj = #{zymj} where fxid =#{fxid} ")
    void updateAdjustZymj(@Param("fxid")String fxid,@Param("zymj")double zymj);
}
